package com.wrox.beginspring.pix.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

public class Picture implements Serializable {

    private Integer id;
    private String name;
    private String description;
    private long size;
    private Set<Comment> comments = new HashSet<Comment>();
    private Album album;
    private String fileName;
    private String path;

    public Picture() {
    }

    public Picture(String name, String location) {
        this.name = name;
        this.path = location;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public void setComments(Set<Comment> comments) {
        this.comments = comments;
    }

    public void setAlbum(Album album) {
        this.album = album;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getDescription() {
        return description;
    }

    public long getSize() {
        return size;
    }

    public Set<Comment> getComments() {
        return comments;
    }

    public Album getAlbum() {
        return album;
    }

    public String getFileName() {
        return fileName;
    }

    public String getPath() {
        return path;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void addComment(Comment comment) {
        comments.add(comment);
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
        hash = 37 * hash + (int) (this.size ^ (this.size >>> 32));
        hash = 37 * hash + (this.fileName != null ? this.fileName.hashCode() : 0);
        hash = 37 * hash + (this.path != null ? this.path.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Picture other = (Picture) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        if (this.size != other.size) {
            return false;
        }
        if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) {
            return false;
        }
        if ((this.path == null) ? (other.path != null) : !this.path.equals(other.path)) {
            return false;
        }
        return true;
    }
}